package com.kitty.game.common;

import com.kitty.game.activity.model.product.ActivityType;
import com.kitty.game.config.NPC;
import com.kitty.game.newchoujiang.SendPopMessage;
import com.kitty.game.npc.message.RespNpcContent;
import com.kitty.game.rank.facade.RankController;
import com.kitty.game.role.model.Role;
import com.kitty.mina.cache.DataCache;
import com.kitty.mina.message.MessagePusher;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class TextViewController {
    //查询冲榜
    public  void queryChongBang(Role role, NPC npc){
        String firstTitles = RankController.FIRST_TITLES;
        String title1="虚位以待";
        String title2="虚位以待";
        String title3="虚位以待";
        String title4="虚位以待";
        String title5="虚位以待";
        String title6="虚位以待";
        String title7="虚位以待";
        String title8="虚位以待";
        String title9="虚位以待";
        String title10="虚位以待";
        String title11="虚位以待";
        String title12="虚位以待";

        for (String s : firstTitles.split(",")) {
            if("一马当先".equals(s.split(":")[0])){
                title1 = s.split(":")[1];
            }
            if("力敌千钧".equals(s.split(":")[0])){
                title2 = s.split(":")[1];
            }
            if("法力无边".equals(s.split(":")[0])){
                title3 = s.split(":")[1];
            }
            if("风驰电掣".equals(s.split(":")[0])){
                title4 = s.split(":")[1];
            }
            if("铜墙铁壁".equals(s.split(":")[0])){
                title5 = s.split(":")[1];
            }
            if("道法稳固".equals(s.split(":")[0])){
                title6 = s.split(":")[1];
            }
            if("巅峰战力".equals(s.split(":")[0])){
                title7 = s.split(":")[1];
            }
            if("万道归一·金".equals(s.split(":")[0])){
                title8 = s.split(":")[1];
            }
            if("万道归一·木".equals(s.split(":")[0])){
                title9 = s.split(":")[1];
            }
            if("万道归一·水".equals(s.split(":")[0])){
                title10 = s.split(":")[1];
            }
            if("万道归一·火".equals(s.split(":")[0])){
                title11 = s.split(":")[1];
            }
            if("万道归一·土".equals(s.split(":")[0])){
                title12 = s.split(":")[1];
            }
        }
        SendPopMessage respGeneralNotify = new SendPopMessage();
        String message = "BattlePassMisonRuleDlg|"+title1+"|"+title2+"|"+title3+"|"+title4+"|"+title5+"|"+title6+"|"+title7+"|"+title8+"|"+title9+"|"+title10+"|"+title11+"|"+title12;
        System.out.println(message);
        respGeneralNotify.setName(message);
        respGeneralNotify.setType((byte)2);
        MessagePusher.pushMessage(role, respGeneralNotify);
    }
    //查询任务次数
    public  void queryTaskCount(Role role, NPC npc){

        RespNpcContent respNpcContent = new RespNpcContent();
        StringBuffer sb = new StringBuffer();
        int fuxingSum = ActivityType.fuxing_ACTIVTY.getTotalCount();
        int fuxing =  role.getActivity().getFinishCounts().getInt(ActivityType.fuxing_ACTIVTY.getActivityId(), 0);
        int zhanshenSum = ActivityType.zhansheng_ACTIVTY.getTotalCount();
        int zhanshen = role.getActivity().getFinishCounts().getInt(ActivityType.zhansheng_ACTIVTY.getActivityId(), 0);
        int caishenSum = ActivityType.caishen_ACTIVTY.getTotalCount();
        int caishen =  role.getActivity().getFinishCounts().getInt(ActivityType.caishen_ACTIVTY.getActivityId(), 0);
        int haidaoSum = ActivityType.haidao_ACTIVTY.getTotalCount();
        int haidao =  role.getActivity().getFinishCounts().getInt(ActivityType.haidao_ACTIVTY.getActivityId(), 0);
        int tianxingSum = ActivityType.XING_GUAN_tian.getTotalCount();
        int tianxing = role.getActivity().getFinishCounts().getInt(ActivityType.XING_GUAN_tian.getActivityId(), 0);
        int dixingSum = ActivityType.XING_GUAN_di.getTotalCount();
        int dixing = role.getActivity().getFinishCounts().getInt(ActivityType.XING_GUAN_di.getActivityId(), 0);
        int bianyiSum = ActivityType.bianyixingjun_ACTIVTY.getTotalCount();
        int bianyi = role.getActivity().getFinishCounts().getInt(ActivityType.bianyixingjun_ACTIVTY.getActivityId(), 0);
        int shangguSum = ActivityType.SEAL_BOSS2.getTotalCount();
        int shanggu = role.getActivity().getFinishCounts().getInt(ActivityType.SEAL_BOSS2.getActivityId(), 0);
        int wannianSum = ActivityType.SEAL_BOSS.getTotalCount();
        int wannian = role.getActivity().getFinishCounts().getInt(ActivityType.SEAL_BOSS.getActivityId(), 0);
        int tianjiepanjunSum = ActivityType.tianjiepanjun_ACTIVTY.getTotalCount();
        int tianjiepanjun = role.getActivity().getFinishCounts().getInt(ActivityType.tianjiepanjun_ACTIVTY.getActivityId(), 0);
        int molongweiSum = ActivityType.molongzhiwei.getTotalCount();
        int molongwei = role.getActivity().getFinishCounts().getInt(ActivityType.molongzhiwei.getActivityId(), 0);
        int molongzhuaSum = ActivityType.molongzhizhua.getTotalCount();
        int molongzhua = role.getActivity().getFinishCounts().getInt(ActivityType.molongzhizhua.getActivityId(), 0);
        int molongshouSum = ActivityType.molongzhishou.getTotalCount();
        int molongshou = role.getActivity().getFinishCounts().getInt(ActivityType.molongzhishou.getActivityId(), 0);
        int molongtianSum = ActivityType.molongtuntian.getTotalCount();
        int molongtian = role.getActivity().getFinishCounts().getInt(ActivityType.molongtuntian.getActivityId(), 0);
        int molongyanSum = ActivityType.molongzhiyan.getTotalCount();
        int molongyan = role.getActivity().getFinishCounts().getInt(ActivityType.molongzhiyan.getActivityId(), 0);
        int jiutianSum = ActivityType.JTZJ.getTotalCount();
        int jiutian = role.getActivity().getFinishCounts().getInt(ActivityType.JTZJ.getActivityId(), 0);
        int qishaSum = ActivityType.QSXJ.getTotalCount();
        int qisha = role.getActivity().getFinishCounts().getInt(ActivityType.QSXJ.getActivityId(), 0);
        int mingyanSum = ActivityType.lymy.getTotalCount();
        int mingyan = role.getActivity().getFinishCounts().getInt(ActivityType.lymy.getActivityId(), 0);
        int yanhuaSum = ActivityType.nianshou_seal.getTotalCount();
        int yanhua = role.getActivity().getFinishCounts().getInt(ActivityType.nianshou_seal.getActivityId(), 0);
        int shidiSum = ActivityType.shidi.getTotalCount();
        int shidi = role.getActivity().getFinishCounts().getInt(ActivityType.shidi.getActivityId(), 0);
        int chaojiSum = ActivityType.SUPER_BOSS.getTotalCount();
        int chaoji = role.getActivity().getFinishCounts().getInt(ActivityType.SUPER_BOSS.getActivityId(), 0);
        int yizuSum = ActivityType.yizu_ACTIVTY.getTotalCount();
        int yizu = role.getActivity().getFinishCounts().getInt(ActivityType.yizu_ACTIVTY.getActivityId(), 0);
        int difuSum = ActivityType.difupanjun_ACTIVTY.getTotalCount();
        int difu = role.getActivity().getFinishCounts().getInt(ActivityType.difupanjun_ACTIVTY.getActivityId(), 0);
        int yuanhunSum = ActivityType.yuanhun_activity.getTotalCount();
        int yuanhun = role.getActivity().getFinishCounts().getInt(ActivityType.yuanhun_activity.getActivityId(), 0);
        int baxianSum = ActivityType.baxian_activity.getTotalCount();
        int baxian = role.getActivity().getFinishCounts().getInt(ActivityType.baxian_activity.getActivityId(), 0);

        int jianSum = ActivityType.tianyangjian.getTotalCount();
        int jian = role.getActivity().getFinishCounts().getInt(ActivityType.tianyangjian.getActivityId(), 0);
        int zhaSum = ActivityType.tiannezha.getTotalCount();
        int zha = role.getActivity().getFinishCounts().getInt(ActivityType.tiannezha.getActivityId(), 0);
        int xuanSum = ActivityType.tiankongxuan.getTotalCount();
        int xuan = role.getActivity().getFinishCounts().getInt(ActivityType.tiankongxuan.getActivityId(), 0);
        int baiSum = ActivityType.tiantaibai.getTotalCount();
        int bai = role.getActivity().getFinishCounts().getInt(ActivityType.tiantaibai.getActivityId(), 0);
        int jingSum = ActivityType.tianlijing.getTotalCount();
        int jing = role.getActivity().getFinishCounts().getInt(ActivityType.tianlijing.getActivityId(), 0);
        int ziSum = ActivityType.tianleizhnzi.getTotalCount();
        int zi = role.getActivity().getFinishCounts().getInt(ActivityType.tianleizhnzi.getActivityId(), 0);
        int diSum = ActivityType.tiandi.getTotalCount();
        int di = role.getActivity().getFinishCounts().getInt(ActivityType.tiandi.getActivityId(), 0);
        int gongchengSum = ActivityType.guaiwugongcheng.getTotalCount();
        int gongcheng = role.getActivity().getFinishCounts().getInt(ActivityType.guaiwugongcheng.getActivityId(), 0);
        int luobotaoziSum = ActivityType.luobotaozi_ACTIVTY.getTotalCount();
        int luobotaozi = role.getActivity().getFinishCounts().getInt(ActivityType.luobotaozi_ACTIVTY.getActivityId(), 0);
        int qimenmijingSum = ActivityType.mijing.getTotalCount();
        int qimenmijing = role.getActivity().getFinishCounts().getInt(ActivityType.mijing.getActivityId(), 0);

        String yabiaoSum = DataCache.REDIS_DATA.get("YABIAO_COUNT");
        String yabiao = role.getActivity().getYaBiaoCount() + "";


        String fuxingText = fuxing+"/"+fuxingSum;
        String zhanshenText = zhanshen+"/"+zhanshenSum;
        String caishenText = caishen+"/"+caishenSum;
        String haidaoText = haidao+"/"+haidaoSum;
        String tianxingText = tianxing+"/"+tianxingSum;
        String dixingText = dixing+"/"+dixingSum;
        String bianyiText = bianyi+"/"+bianyiSum;
        String shangguText = shanggu+"/"+shangguSum;
        String wannianText = wannian+"/"+wannianSum;
        String tianjieText = tianjiepanjun+"/"+tianjiepanjunSum;
        String weiText = molongwei+"/"+molongweiSum;
        String zhuaText = molongzhua+"/"+molongzhuaSum;
        String shouText = molongshou+"/"+molongshouSum;
        String yanText = molongyan+"/"+molongyanSum;
        String molongtianText = molongtian+"/"+molongtianSum;
        String jiutianText = jiutian+"/"+jiutianSum;
        String qishaText = qisha+"/"+qishaSum;
        String mingyanText = mingyan+"/"+mingyanSum;//////////////
        String yanhuaText = yanhua+"/"+yanhuaSum;
        String shidiText = shidi+"/"+shidiSum;
        String chaojiText = chaoji+"/"+chaojiSum;
        String yizuText = yizu+"/"+yizuSum;
        String difuText = difu+"/"+difuSum;
        String yuanhunText = yuanhun+"/"+yuanhunSum;
        String baxianText = baxian+"/"+baxianSum;
        String jianText = jian+"/"+jianSum;
        String zhaText = zha+"/"+zhaSum;
        String xuanText = xuan+"/"+xuanSum;
        String baiText = bai+"/"+baiSum;
        String jingText = jing+"/"+jingSum;
        String ziText = zi+"/"+ziSum;
        String diText = di+"/"+diSum;
        String gongchengText = gongcheng+"/"+gongchengSum;
        String luobotaoziText = luobotaozi+"/"+luobotaoziSum;
        String qimenmijingText = qimenmijing+"/"+qimenmijingSum;

        String yabiaoText = yabiao+"/"+yabiaoSum;

        SendPopMessage respGeneralNotify = new SendPopMessage();
                String message = "ZhizbtRuleDlg|"+fuxingText+"|"+zhanshenText+"|"+caishenText+"|"+haidaoText+"|"+tianxingText+"|"+dixingText+"|"+bianyiText+"|"+shangguText+"|"+wannianText+"|"+tianjieText+
                        "|"+weiText+"|"+zhuaText+"|"+shouText+"|"+yanText+"|"+molongtianText+"|"+jiutianText+"|"+qishaText+"|"+mingyanText+"|"+yanhuaText+"|"+shidiText+"|"+chaojiText+"|"+yizuText+
                        "|"+difuText+"|"+yuanhunText+"|"+baxianText+"|"+jianText+"|"+zhaText+"|"+xuanText+"|"+baiText+"|"+jingText+"|"+ziText+"|"+diText+"|"+gongchengText+"|"+luobotaoziText+"|"+qimenmijingText+"|" +yabiaoText;
        System.out.println(message);
        respGeneralNotify.setName(message);
        respGeneralNotify.setType((byte)2);
        MessagePusher.pushMessage(role, respGeneralNotify);
    }

}
